package financial.sharing.center.payable.model.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import financial.sharing.center.common.base.BaseEntity;
import financial.sharing.center.common.enums.BillOperationStageEnum;
import financial.sharing.center.common.enums.EnableStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName PayableBill
 * @Description TODO
 * @Author guoyuhang
 * @ @csdn https://blog.csdn.net/qq_40788718
 * @Date 2021/4/15
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@ToString
@Entity
public class PayableBill extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**合同id*/
    private Integer contractId;
    /**付款计提id*/
    private Integer payableAccruedId;
    /**客户名称 - 付款*/
    private String payableCompanyAccountName;
    /**客户名称 - 收款*/
    private String receivableCompanyAccountName;
    /**账单金额*/
    private BigDecimal billAmount;
    /**账单处理阶段*/
    private Integer billOperationStatusValue;
    @Transient
    private String billOperationStatusName;
    /**创建时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;
    /**是否弃用 0:无 1:正常 2:弃用*/
    private Integer enableStatusValue;

    public PayableBill(BigDecimal billAmount, String payableCompanyName, String receivableCompanyName) {
        this.billAmount = billAmount;
        this.payableCompanyAccountName = payableCompanyName;
        this.receivableCompanyAccountName = receivableCompanyName;
        this.createTime = new Date();
        this.billOperationStatusValue = BillOperationStageEnum.待确认.getValue();
        this.enableStatusValue = EnableStatusEnum.正常.getValue();
    }

    public PayableBill(){

    }
}
